﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="goodspay.aspx.cs" Inherits="goodspay" EnableViewState="false" %>
<!DOCTYPE html>
<html>
<head>
    <title>商品支付</title>
</head>
<body>
    <div>
        <section data-role="page" di="goodspay_main">
            <div style="padding:5px;" id="goodspay_content">
                <!--订单信息-->
                <ul data-role="listview" id="goodspayinfo" runat="server">
               	    <li data-role="list-divider">购买支付</li>

                    <li>
                        <div class="payinfo">
						    <p style="margin-bottom:10px;">储值金额：<span style="color:red;"><em runat="server" id="MemMoney">2345</em> 元</span></p>
                            <p>支付金额：<span style="color:red;"><em runat="server" id="payMoney">1523</em> 元</span></p>

                            <label for="payCard">储值支付</label>
                            <input type="text" placeholder="请输入储值支付金额" id="payCard" runat="server" disabled="disabled" />

                            <a data-role="button" data-theme="b" style="margin-top:20px;" id="aSurePay">确认支付</a>
                            <a href="#index" data-role="button" data-theme="b" style="display:none;" id="goBack">返回首页</a>
                            <input type="hidden" runat="server" id="txtMicroOrderID" />
                        </div>
                    </li>
                </ul>

                
                <!--商品清单-->
                <ul data-role="listview" id="goodsinventory">
                    <li data-role="list-divider">商品清单</li>
                     <div style="text-align:center;font-size:12px;display:none;" runat="server" id="msg"><img src="images/sc.png" style="width:30%;margin-top:150px;"/><br/><br/><span id="msgText" style="font-size:18px;color:#aaa;">商品信息已经过期</span></div>
                    <li id="hiden"  runat="server" >
                        <div class="detail-main">
                            <asp:Repeater runat="server" ID="rptGoodsinventory">
                                <ItemTemplate>
                                    <div class="detail_row">
                	                    <!--left-->
                                        <div class="row_item row_item-left">
                                            <img onerror="javascript:this.src='../images/Gift/nogift.jpg'" src="<%#Eval("MicroGoodsPicture") %>"/>
                                        </div>
                                        <!--right-->
                                        <div class="row_item row_item-right">
                                            <strong style="font-size:14px;"><%#Eval("MicroGoodsName")%></strong>
                                            <span style="margin:5px 0;display:block;">会员价：&nbsp;&nbsp;<span class="discountPrice"><%#Convert.ToDecimal(Eval("MicroPrice")).ToString("0.00")%></span>元</span>
                                            <span style="display:block;">购买数量：<%#Eval("ConvertNumber")%></span>
                                        </div>
                                        <!--right end-->
                                    </div>
                                </ItemTemplate>
                            </asp:Repeater>
                            <hr />
                            <span id="total" runat="server"></span>
                        </div>
                    </li>

                </ul>
            </div>
            
            <script type="text/javascript">
                $("#aSurePay").click(function () {
                    $("#aSurePay").attr('disabled', "true");
                    var payMoney = $.trim($("#payMoney").text());
                    var MemMoney = $.trim($("#MemMoney").text());
                    var payCard = $.trim($("#payCard").val());
                    if (parseFloat(payCard) > parseFloat(MemMoney)) { alert("您当前金额不足!"); return; }
                    $.get("../Service/AjaxService.ashx?Method=GoodPay",
                    {
                        "MicroOrderID": $("#txtMicroOrderID").val(),
                        "MemID": getCookie("uid"),
                        "payMoney": payCard
                    }
                    , function (text) {
                        switch (text) {
                            case "0":
                                alert("系统有点繁忙，提交失败!");
                                break;
                            case "-1":
                                alert("您当前金额不足!");
                                break;
                            case "-2":
                                alert("该订单已支付，请勿重新提交!");
                                break;
                            default:
                                alert("支付成功!");
                                $("#goBack").click();
                                break;
                        }
                        $("#aSurePay").removeAttr("disabled");
                    }, "text")
                })
                
            </script>

       

            <footer data-role="footer" data-position="fixed" id="goodspay_footer">
                <div data-role="navbar" id="nav-glyphish-example">
                    <ul>
                        <li><a href="#index" id="A1"><img src="images/business_site_btn.png" /><br/>商家网站</a></li>
                        <li class="footer_active"><a href="#goodlist" id="A2" data-load="goodlist.aspx"><img src="images/02.png" /><br/>商品购买</a></li>
                        <li><a href="#membershipcard" data-load="membershipcard.aspx" id="A3"><img src="images/member_card_btn.png" /><br/>会员卡</a></li>
                        <li><a href="#giftlist" data-load="giftlist.aspx" id="A4" class="ui-btn-active"><img src="images/exchange_btn.png" /><br/>积分兑换</a></li>
                    </ul>
                </div>
            </footer>

        </section>
    </div>
</body>
</html>
